/*
 * @Author: Zhouhai 497675647@qq.com
 * @Date: 2022-09-22 15:59:05
 * @LastEditors: Zhouhai 497675647@qq.com
 * @LastEditTime: 2023-06-13 15:14:55
 */

// routing
import Routes from './routes';
import { ConfigProvider,theme} from 'antd';
import FrontendAuth from './pages/Layout/FrontendAuth ';
import { AliveScope } from 'react-activation'
import zhCN from 'antd/es/locale/zh_CN';
import { useStore } from '@/store';
import { observer } from 'mobx-react-lite';

import './App.less'

const { darkAlgorithm, compactAlgorithm } = theme;

const App = () => {

  const {layoutColorStore} = useStore();

  const getThem = () =>{
    let algorithm = [];
    if(layoutColorStore.mainValue === 'dark'){
      algorithm.push(darkAlgorithm)
    }

    if(layoutColorStore.formSize === 'compact'){
      algorithm.push(compactAlgorithm)
    }

    return {
      token: layoutColorStore.themeToke,
      algorithm: algorithm
    }
    
  }
  

  return (
    <ConfigProvider locale={zhCN} theme={getThem()}>
      <div className='App-background' style={layoutColorStore.mainValue === 'default' ? { opacity: 1}  : {opacity: 0}}>
        <img className='App-background-img1' src= "https://gw.alipayobjects.com/zos/bmw-prod/bd71b0c6-f93a-4e52-9c8a-f01a9b8fe22b.svg" alt= 'default' />
        <img className='App-background-img2' src= "https://gw.alipayobjects.com/zos/bmw-prod/84ad805a-74cb-4916-b7ba-9cdc2bdec23a.svg" alt= 'default' />
      </div>
      <div className='App-background' style={layoutColorStore.mainValue === 'dark' ? { opacity: 1}  : {opacity: 0}}>
        <img className='App-background-img3' src= "https://gw.alipayobjects.com/zos/bmw-prod/a213184a-f212-4afb-beec-1e8b36bb4b8a.svg" alt= 'default' />
        <img className='App-background-img4' src= "https://gw.alipayobjects.com/zos/bmw-prod/bb74a2fb-bff1-4d0d-8c2d-2ade0cd9bb0d.svg" alt= 'default' />
      </div>
      <img className='App-background-picture' src= "https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*MtVDSKukKj8AAAAAAAAAAAAAARQnAQ" alt= 'default' style={{opacity: 0}}/>
      <img className='App-background-picture' src= "https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*FMluR4vJhaQAAAAAAAAAAAAAARQnAQ" alt= 'default' style={{opacity: 0}}/>
      <img className='App-background-picture' src= "https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*DGZXS4YOGp0AAAAAAAAAAAAAARQnAQ" alt= 'default' style={layoutColorStore.mainValue === 'peachBlossom' ? { opacity: 1}  : {opacity: 0}}/>
      <img className='App-background-picture' src= "https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*w6xcR7MriwEAAAAAAAAAAAAAARQnAQ" alt= 'default' style={{opacity: 0}}/>
      <img className='App-background-picture' src= "https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*VWFOTbEyU9wAAAAAAAAAAAAAARQnAQ" alt= 'default' style={{opacity: 0}}/>
      <img className='App-background-picture' src= "https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*1yydQLzw5nYAAAAAAAAAAAAAARQnAQ" alt= 'default' style={{opacity: 0}}/>
      <img className='App-background-picture' src= "https://gw.alipayobjects.com/mdn/rms_08e378/afts/img/A*XpGeRoZKGycAAAAAAAAAAAAAARQnAQ" alt= 'default' style={layoutColorStore.mainValue === 'knowledge' ? { opacity: 1}  : {opacity: 0}}/>
      <AliveScope>
        <FrontendAuth>
          <Routes />
        </FrontendAuth>
      </AliveScope>
    </ConfigProvider>
  );
};

export default observer(App);
